﻿using AttributeRouting.Web.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class UpdateWaterController : ApiController
    {
        private UpdateWater uw;

        [POST("GetUpdateWaters")]
        public IList<UpdateWater> PostGetUpdateWaters(MeterUpdateCondition muc)
        {
            uw = new UpdateWater();
            return uw.QueryMeterUpdate(muc);
        }
        /*
        [POST("GetUpdateWatersCount")]
        public int PostGetUpdateWatersCount(UpdateWater info)
        {
            var where = UpdateWaterWhere(info);
            int count = rep.LoadCount(where);
            return count;
        }
        */
        
        [POST("AddUpdateWater")]
        public bool PostAddUpdateWater(UpdateWater info)
        {
            info.MRNO = BuilderMrno.GetMrnoFortbl("Tbt_UpdateWater");
            uw = new UpdateWater();
            bool result = uw.AddUpdateWater(info) > 0 ? true : false;
            return result;
        }
        /*
        [POST("EditUpdateWater")]
        public bool PostEditUpdateWater(UpdateWater info)
        {
            bool result = rep.Edit(info);
            return result;
        }

        [GET("DeleteUpdateWater/{code}")]
        public bool GetDeleteUpdateWater(string code)
        {
            bool result = rep.Delete(code);
            return result;
        }

        [GET("GetUpdateWater/{code}")]
        public UpdateWater GetUpdateWater(string code)
        {
            var result = rep.Get(code);
            return result;
        }
         * */
    }
}
